﻿// <copyright file="ValueOutsideOfRangeException.cs" company="TenneySoftware">
// Copyright (c) 2009 All Right Reserved
// </copyright>
// <author>Robert Tenney</author>
// <email>rob10e@yahoo.com</email>
// <date>April 2009</date>
// <summary>Exception throw when value given is not within the preset range.</summary>

// License:

// Product:
// Author: Robert N. Tenney
// Copyright: April 2009

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation version 2
// of the License.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// This license covers all source code, binaries, and other materials related to this project
// unless specifically stated otherwise.

using System;

namespace TenneySoftware.Engine {
    /// <summary>
    /// Exception thrown when value given is not within the preset range.
    /// </summary>
    [Serializable]
    public class ValueOutsideOfRangeException : Exception {
        /// <summary>
        /// Initializes a new instance of the ValueOutsideOfRangeException class.
        /// </summary>
        public ValueOutsideOfRangeException() : base() {
        }

        /// <summary>
        /// Initializes a new instance of the ValueOutsideOfRangeException class.
        /// </summary>
        /// <param name="errorMessage">Error message to throw.</param>
        public ValueOutsideOfRangeException(string errorMessage) : base(errorMessage) {
        }

        /// <summary>
        /// Initializes a new instance of the ValueOutsideOfRangeException class.
        /// </summary>
        /// <param name="errorMessage">Error message to throw.</param>
        /// <param name="innerException">Inner exception.</param>
        public ValueOutsideOfRangeException(string errorMessage, Exception innerException) :
        base(errorMessage, innerException) {
        }

        /// <summary>
        /// Initializes a new instance of the ValueOutsideOfRangeException class.
        /// </summary>
        /// <param name="serialInfo">Serialization information.</param>
        /// <param name="context">Streaming context for serialization.</param>
        protected ValueOutsideOfRangeException(
            System.Runtime.Serialization.SerializationInfo serialInfo,
            System.Runtime.Serialization.StreamingContext context) :
        base(serialInfo, context) {
        }

        /// <summary>
        /// Gets the error message generated by the exception.
        /// </summary>
        /// <value>
        /// The error message generated by the exception.
        /// </value>
        public override string Message {
            get {
                return base.Message.ToString();
            }
        }
    }
}
